package com.qqzone.qq.service.impl;

import com.qqzone.qq.dao.UserBasicDao;
import com.qqzone.qq.pojo.UserBasic;
import com.qqzone.qq.service.UserBasicService;

import java.util.ArrayList;
import java.util.List;

public class UserBasicServiceImpl implements UserBasicService {

    private UserBasicDao userBasicDao;

    @Override
    public UserBasic login(String loginId, String pwd) {

        return userBasicDao.getUserBasic(loginId, pwd);
    }

    @Override
    public List<UserBasic> getFriendList(UserBasic userBasic) {
        List<UserBasic> userBasicList = userBasicDao.getUserBasicList(userBasic);
        List<UserBasic> firendList = new ArrayList<UserBasic>(userBasicList.size());
        for (int i = 0; i < userBasicList.size(); i++) {
            UserBasic firend = userBasicDao.getUserBasicById(userBasicList.get(i).getId());
            firendList.add(firend);

        }
        return firendList;
    }

    @Override
    public UserBasic getUserBasicById(Integer id) {
        return userBasicDao.getUserBasicById(id);
    }
}
